<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Configs extends Model
{
    protected $guarded  = ['id'];
    public $timestamps = false;
    public static function val($key, $type = 'val')
    {
        $model = self::firstOrCreate(['key' => $key]);
        if ($type == 'val')
            return isset($model->val) ? $model->val : '';
        else
            return $model;
    }
}
